/**
 * @param {string} s是
 * @return {boolean}
 */
var isValid = function (s) {
    let left = []
    for (let c of s) {
        if (c === '(' || c === '{' || c === '[') {
            left.push(c);
        } else {
            // 字符c是右括号
            //出现右括号，检查堆栈是否为空，以及顶部元素是否与该右括号相同
            if (left.length !== 0 && leftOf(c) === left[left.length - 1]) {
                left.pop();
            } else {
                // 和最近的左括号不匹配
                return false;
            }
        }
    }
    return left.length === 0;
};


let leftOf = function (c) {
    if (c === '}') return '{';
    if (c === ')') return '(';
    return '[';
}

let c = "aaaaaaaa"
for (let a of c) {
    console.log(a)
}
